package com.woniu.order.controller;

import com.woniu.common.utils.PageData;
import com.woniu.common.utils.ResponseData;
import com.woniu.order.dto.ZsbAddProductDto;
import com.woniu.order.dto.ZsbProductDto;
import com.woniu.order.pojo.ZsbOrderApplication;
import com.woniu.order.pojo.dto.ZcxCustomerOrderDTO;
import com.woniu.order.service.ZsbOrderApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.security.auth.callback.CallbackHandler;
import java.util.List;

@RestController
@RequestMapping("/zsbOrder")
public class ZsbOrderController {

    @Autowired
    private ZsbOrderApplicationService zsbOrderApplicationService;

    @PostMapping("/queryAllCustomer")
    public ResponseData<?> queryAllCustomer(){
        return zsbOrderApplicationService.queryAllCustomer();
    }
    @PostMapping("/createSnowId")
    public ResponseData<?> createSnowId(){
        return zsbOrderApplicationService.createSnowId();
    }

    @PostMapping("/queryAllProduct")
    public ResponseData<?> queryAllProduct(){
        return zsbOrderApplicationService.queryAllProduct();
    }

    @PostMapping("/addProduct")
    public ResponseData<?> addProduct( @RequestBody ZsbAddProductDto zsbAddProductDto){
        return zsbOrderApplicationService.addOrderApplicationProduct(zsbAddProductDto);
    }

    @GetMapping("/getOrderPrice/{code}")
    public ResponseData<?> getOrderPrice( @PathVariable("code") String code){
        return zsbOrderApplicationService.getPrice(code);
    }

    @PostMapping("/addOrderApplication")
    public ResponseData<?> addOrderApplication( @RequestBody ZsbOrderApplication zsbOrderApplication){
        return zsbOrderApplicationService.addOrderApplication(zsbOrderApplication);
    }


    @PostMapping("/queryJLWeiShenPi")
    public ResponseData<?> queryJLWeiShenPi(@RequestBody PageData<ZsbOrderApplication> pageData){
        return zsbOrderApplicationService.queryJLWeiShenPi(pageData);
    }

    @PostMapping("/queryJLYiShenPi")
    public ResponseData<?> queryJLYiShenPi(@RequestBody PageData<ZsbOrderApplication> pageData){
        return zsbOrderApplicationService.queryJLYiShenPi(pageData);
    }


    @PostMapping("/refuseApplication")
    public ResponseData<?> refuseApplication(@RequestBody ZsbOrderApplication zsbOrderApplication){
        return zsbOrderApplicationService.refuseApplication(zsbOrderApplication);
    }


    @PostMapping("/passjlApplication")
    public ResponseData<?> passjlApplication(@RequestBody ZsbOrderApplication zsbOrderApplication){
        return zsbOrderApplicationService.passjlApplication(zsbOrderApplication);
    }


    @PostMapping("/querySaleWeiShenPi")
    public ResponseData<?> querySaleWeiShenPi(@RequestBody PageData<ZsbOrderApplication> pageData){
        return zsbOrderApplicationService.querySaleWeiShenPi(pageData);
    }

    @PostMapping("/querySaleTongGuo")
    public ResponseData<?> querySaleTongGuo(@RequestBody PageData<ZsbOrderApplication> pageData){
        return zsbOrderApplicationService.querySaleTongGuo(pageData);
    }

    @PostMapping("/querySaleRefuse")
    public ResponseData<?> querySaleRefuse(@RequestBody PageData<ZsbOrderApplication> pageData){
        return zsbOrderApplicationService.querySaleRefuse(pageData);
    }

    @PostMapping("/queryZJWeiShenPi")
    public ResponseData<?> queryZJWeiShenPi(@RequestBody PageData<ZsbOrderApplication> pageData){
        return zsbOrderApplicationService.queryZJWeiShenPi(pageData);
    }

    @PostMapping("/queryZJYiShenPi")
    public ResponseData<?> queryZJYiShenPi(@RequestBody PageData<ZsbOrderApplication> pageData){
        return zsbOrderApplicationService.queryZJYiShenPi(pageData);
    }

    @PostMapping("/addOrder")
    public ResponseData<?> addOrder(@RequestBody ZsbOrderApplication zsbOrderApplication){
        return zsbOrderApplicationService.addOrder(zsbOrderApplication);
    }

    @GetMapping("/queryDetail/{code}")
    public ResponseData<?> queryDetail(@PathVariable("code") String code){
        return zsbOrderApplicationService.queryDetail(code);
    }

    @GetMapping("/queryChaiFenCOunt/{chaiFenCount}/{orderCode}")
    public ResponseData<?> queryDetail(@PathVariable("chaiFenCount") Integer chaiFenCount,@PathVariable("orderCode") String orderCode){
        return zsbOrderApplicationService.queryProductCount(chaiFenCount,orderCode);
    }






}
